﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using MixScriptWeb.control;

namespace MixScriptWeb.Jideco.MM
{
    public partial class GRNrpt : cCommonWeb2
    {
        private static DateTime tglPO;
        protected void Page_Load(object sender, EventArgs e)
        {
            if (!Page.IsPostBack)
            {

                tglPO = DateTime.Now;
                addFindClickAttribute(this, new MixScriptTB[] { txtSupCode }, new string[] { "SRCSUPGJ" });

                txtDate1.Text = tglPO.ToString("dd-MM-yyyy");
                txtDate2.Text = tglPO.ToString("dd-MM-yyyy");
            }         
        }
       
        protected void btnClear_Click(object sender, EventArgs e)
        {
            txtGRN.Text = "";
        }

        protected void btnReport_Click(object sender, EventArgs e)
        {

            Session["sGRNID"] = txtGRN.Text;
            Session["supp"] = txtSupCode.Text;
            Session["sawal"] = txtDate1.Text.Substring(6, 4) + "-" + txtDate1.Text.Substring(3, 2) + "-" + txtDate1.Text.Substring(0, 2) + " 00:00:00";
            Session["sakhir"] = txtDate2.Text.Substring(6, 4) + "-" + txtDate2.Text.Substring(3, 2) + "-" + txtDate2.Text.Substring(0, 2) + " 23:59:59";

            string sscript = "";
            sscript += "<script>";
            sscript += "window.open('../print/rptid-8,GRNID-" + "" + ",suppid-" + "" + ",dl.html', '_blank');";
            sscript += "</script>";
            ClientScript.RegisterStartupScript(GetType(), "report", sscript);                 
        }
    }
}